package com.radon.config;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.core.RabbitTemplate.ReturnCallback;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Service;

/**
 * 发送失败的时候会调用(exchange到queue成功)
 *
 */
@Configuration
public class RabbitSendReturnback implements ReturnCallback {
	private static Logger logger = LoggerFactory.getLogger(RabbitSendReturnback.class);
	@Override
	public void returnedMessage(Message message, int replyCode, String replyText, String exchange, String routingKey) {
		// TODO Auto-generated method stub
		logger.error("发送失败的消息:"+message);
		logger.error("交换机信息:"+exchange);
		logger.error("路由key信息:"+routingKey);
		logger.error("失败的编码:"+replyCode);
		logger.error("失败信息:"+replyText);
	}

}
